<template>
  <div class="question-wrapper">
    <nuxt-link class="button button--grey" to="/" replace>首页</nuxt-link>
    <button class="button button--green" @click="back">前一页</button>
    <button class="button button--grey" @click="next">后一页</button>
  </div>
</template>

<script>
  export default {
    computed: {
      current() {
        return Number(this.$route.params.page)
      }
    },
    methods: {
      back() {
        this.$router.back()
      },
      next() {
        this.$router.push({
          name: 'question-page',
          params: {
            page: this.current + 1
          }
        })
      },
      init(to, from) {
        
      }
    },
    beforeRouteEnter(to, from, next) {
      next(vm => vm.init(to, from))
    }
  }
</script>

<style lang="scss">
  .question-wrapper {
    display: flex;
  }
</style>